package com.mrdeer.common.entity.dto;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.mrdeer.common.base.Converter;
import com.mrdeer.common.entity.beans.PageEntity;
import com.mrdeer.common.entity.sys.UserRole;
import lombok.*;
import org.springframework.beans.BeanUtils;

@Data
@NoArgsConstructor
@AllArgsConstructor
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
public class UserRoleDTO extends UserRole implements Converter<UserRole, UserRoleDTO> {


    @JsonInclude(JsonInclude.Include.NON_NULL)
    private PageEntity page;

    @Override
    public void convert2Do(UserRole userRole) {
        BeanUtils.copyProperties(this, userRole);
    }

    @Override
    public UserRoleDTO convert(UserRole userRole) {
        BeanUtils.copyProperties(userRole, this);
        return this;
    }
}
